import { Text } from "@mantine/core";
import { useAPIUtils } from "./APIUtilsProvider";

export default function DictionaryItemText({ dictName, itemKey }) {
  const { tanstackQuery } = useAPIUtils();

  const query = tanstackQuery(`/api/dictionaries/${dictName}`);
  if (!query.data) {
    return <></>;
  }
  return <Text>{query.data[itemKey]?.text}</Text>;
}
